home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / OpenGL 1.0 SDK / Headers / aux.h < prev    next >
Encoding:
Text File  |  1999-05-18  |  9.6 KB  |  329 lines  |  [TEXT/CWIE]

  1. /*
  2.  * (c) Copyright 1993, Silicon Graphics, Inc.
  3.  * ALL RIGHTS RESERVED 
  4.  * Permission to use, copy, modify, and distribute this software for 
  5.  * any purpose and without fee is hereby granted, provided that the above
  6.  * copyright notice appear in all copies and that both the copyright notice
  7.  * and this permission notice appear in supporting documentation, and that 
  8.  * the name of Silicon Graphics, Inc. not be used in advertising
  9.  * or publicity pertaining to distribution of the software without specific,
  10.  * written prior permission. 
  11.  *
  12.  * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
  13.  * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
  14.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
  15.  * FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL SILICON
  16.  * GRAPHICS, INC.  BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
  17.  * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
  18.  * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
  19.  * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
  20.  * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC.  HAS BEEN
  21.  * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
  22.  * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
  23.  * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
  24.  * 
  25.  * US Government Users Restricted Rights 
  26.  * Use, duplication, or disclosure by the Government is subject to
  27.  * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
  28.  * (c)(1)(ii) of the Rights in Technical Data and Computer Software
  29.  * clause at DFARS 252.227-7013 and/or in similar or successor
  30.  * clauses in the FAR or the DOD or NASA FAR Supplement.
  31.  * Unpublished-- rights reserved under the copyright laws of the
  32.  * United States.  Contractor/manufacturer is Silicon Graphics,
  33.  * Inc., 2011 N.  Shoreline Blvd., Mountain View, CA 94039-7311.
  34.  *
  35.  * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
  36.  */
  37.  
  38. #ifndef __GLAUX_H__
  39. #define __GLAUX_H__
  40.  
  41. #include "stdlib.h"
  42. #include "stdio.h"
  43. #include "string.h"
  44.  
  45. #include "gl.h"
  46. #include "glu.h"
  47. #include "agl.h"
  48.  
  49. #ifdef __cplusplus
  50. extern "C" {
  51. #endif
  52.  
  53. /*
  54. ** ToolKit Window Types
  55. ** In the future, AUX_RGBA may be a combination of both RGB and ALPHA
  56. */
  57.  
  58. #define AUX_RGB             0
  59. #define AUX_INDEX           1
  60.  
  61. #define AUX_SINGLE          0
  62. #define AUX_DOUBLE          2
  63.  
  64. #define AUX_DIRECT          0
  65. #define AUX_INDIRECT        4
  66. #define AUX_ACCUM           8
  67. #define AUX_ALPHA           16
  68. #define AUX_DEPTH           32
  69. #define AUX_STENCIL         64
  70. #define AUX_OVERLAY            128
  71. #define AUX_UNDERLAY        256
  72. #define AUX_AUX             512
  73. #define AUX_FULLSCREEN      1024
  74. /* 
  75. ** Window Masks
  76. */
  77.  
  78. #define AUX_WIND_IS_RGB(x)      (((x) & AUX_INDEX) == 0)
  79. #define AUX_WIND_IS_INDEX(x)    (((x) & AUX_INDEX) != 0)
  80. #define AUX_WIND_IS_SINGLE(x)   (((x) & AUX_DOUBLE) == 0)
  81. #define AUX_WIND_IS_DOUBLE(x)   (((x) & AUX_DOUBLE) != 0)
  82. #define AUX_WIND_IS_DIRECT(x)   (((x) & AUX_INDIRECT) == 0)
  83. #define AUX_WIND_IS_INDIRECT(x) (((x) & AUX_INDIRECT) != 0)
  84. #define AUX_WIND_HAS_ACCUM(x)   (((x) & AUX_ACCUM) != 0)
  85. #define AUX_WIND_HAS_ALPHA(x)   (((x) & AUX_ALPHA) != 0)
  86. #define AUX_WIND_HAS_AUX(x)     (((x) & AUX_AUX) != 0)
  87. #define AUX_WIND_HAS_DEPTH(x)   (((x) & (AUX_DEPTH | AUX_DEPTH16)) != 0)
  88. #define AUX_WIND_HAS_STENCIL(x) (((x) & AUX_STENCIL) != 0)
  89.  
  90. /*
  91. ** ToolKit Event Structure
  92. */
  93.  
  94. typedef struct _AUX_EVENTREC {
  95.     GLint event;
  96.     GLint data[4];
  97. } AUX_EVENTREC;
  98.  
  99. /* 
  100. ** ToolKit Event Types
  101. */
  102. #define AUX_EXPOSE      1
  103. #define AUX_CONFIG      2
  104. #define AUX_DRAW        4
  105. #define AUX_KEYEVENT    8
  106. #define AUX_MOUSEDOWN   16
  107. #define AUX_MOUSEUP     32
  108. #define AUX_MOUSELOC    64
  109.  
  110. /*
  111. ** Toolkit Event Data Indices
  112. */
  113. #define AUX_WINDOWX             0
  114. #define AUX_WINDOWY             1
  115. #define AUX_MOUSEX              0
  116. #define AUX_MOUSEY              1
  117. #define AUX_MOUSESTATUS         3
  118. #define AUX_KEY                 0
  119. #define AUX_KEYSTATUS           1
  120.  
  121. /*
  122. ** ToolKit Event Status Messages
  123. */
  124. #define AUX_LEFTBUTTON          1
  125. #define AUX_RIGHTBUTTON         2
  126. #define AUX_MIDDLEBUTTON        4
  127. #define AUX_SHIFT               1
  128. #define AUX_CONTROL             2
  129.  
  130. /* 
  131. ** ToolKit Key Codes
  132. */
  133. #define AUX_RETURN              0x0D
  134. #define AUX_ESCAPE              0x1B
  135. #define AUX_SPACE               0x20
  136. #define AUX_LEFT                0x25
  137. #define AUX_UP                  0x26
  138. #define AUX_RIGHT               0x27
  139. #define AUX_DOWN                0x28
  140. #define AUX_A                   'A'
  141. #define AUX_B                   'B'
  142. #define AUX_C                   'C'
  143. #define AUX_D                   'D'
  144. #define AUX_E                   'E'
  145. #define AUX_F                   'F'
  146. #define AUX_G                   'G'
  147. #define AUX_H                   'H'
  148. #define AUX_I                   'I'
  149. #define AUX_J                   'J'
  150. #define AUX_K                   'K'
  151. #define AUX_L                   'L'
  152. #define AUX_M                   'M'
  153. #define AUX_N                   'N'
  154. #define AUX_O                   'O'
  155. #define AUX_P                   'P'
  156. #define AUX_Q                   'Q'
  157. #define AUX_R                   'R'
  158. #define AUX_S                   'S'
  159. #define AUX_T                   'T'
  160. #define AUX_U                   'U'
  161. #define AUX_V                   'V'
  162. #define AUX_W                   'W'
  163. #define AUX_X                   'X'
  164. #define AUX_Y                   'Y'
  165. #define AUX_Z                   'Z'
  166. #define AUX_a                   'a'
  167. #define AUX_b                   'b'
  168. #define AUX_c                   'c'
  169. #define AUX_d                   'd'
  170. #define AUX_e                   'e'
  171. #define AUX_f                   'f'
  172. #define AUX_g                   'g'
  173. #define AUX_h                   'h'
  174. #define AUX_i                   'i'
  175. #define AUX_j                   'j'
  176. #define AUX_k                   'k'
  177. #define AUX_l                   'l'
  178. #define AUX_m                   'm'
  179. #define AUX_n                   'n'
  180. #define AUX_o                   'o'
  181. #define AUX_p                   'p'
  182. #define AUX_q                   'q'
  183. #define AUX_r                   'r'
  184. #define AUX_s                   's'
  185. #define AUX_t                   't'
  186. #define AUX_u                   'u'
  187. #define AUX_v                   'v'
  188. #define AUX_w                   'w'
  189. #define AUX_x                   'x'
  190. #define AUX_y                   'y'
  191. #define AUX_z                   'z'
  192. #define AUX_0                   '0'
  193. #define AUX_1                   '1'
  194. #define AUX_2                   '2'
  195. #define AUX_3                   '3'
  196. #define AUX_4                   '4'
  197. #define AUX_5                   '5'
  198. #define AUX_6                   '6'
  199. #define AUX_7                   '7'
  200. #define AUX_8                   '8'
  201. #define AUX_9                   '9'
  202.  
  203. /*
  204. ** ToolKit Gets and Sets
  205. */
  206. #define AUX_FD                  1  /* return fd (long) */
  207. #define AUX_COLORMAP            3  /* pass buf of r, g and b (unsigned char) */
  208. #define AUX_GREYSCALEMAP        4
  209. #define AUX_FOGMAP              5  /* pass fog and color bits (long) */
  210. #define AUX_ONECOLOR            6  /* pass index, r, g, and b (long) */
  211.  
  212. /*
  213. ** Color Macros
  214. */
  215.  
  216. #define AUX_BLACK               0
  217. #define AUX_RED                 13
  218. #define AUX_GREEN               14
  219. #define AUX_YELLOW              15
  220. #define AUX_BLUE                16
  221. #define AUX_MAGENTA             17
  222. #define AUX_CYAN                18
  223. #define AUX_WHITE               19
  224.  
  225. extern float auxRGBMap[20][3];
  226.  
  227. #define AUX_SETCOLOR(x, y) (AUX_WIND_IS_RGB((x)) ? \
  228.                            glColor3fv(auxRGBMap[(y)]) : glIndexf((y)))
  229.  
  230. /*
  231. ** RGB Image Structure
  232. */
  233.  
  234. typedef struct _AUX_RGBImageRec {
  235.     GLint sizeX, sizeY;
  236.     unsigned char *data;
  237. } AUX_RGBImageRec;
  238.  
  239. /*
  240. ** Prototypes
  241. */
  242.  
  243. void auxInitDisplayMode(GLenum);
  244. void auxInitPosition(int, int, int, int);
  245.  
  246. GLenum auxInitWindow(char *title);
  247. void auxCloseWindow(void);
  248. void auxQuit(void);
  249. void auxSwapBuffers(void);
  250.  
  251. typedef void (* AUXMAINPROC)(void);
  252. void auxMainLoop(AUXMAINPROC);
  253.  
  254. typedef void (* AUXEXPOSEPROC)(int, int);
  255. void auxExposeFunc(AUXEXPOSEPROC);
  256.  
  257. typedef void (* AUXRESHAPEPROC)(int, int);
  258. void auxReshapeFunc(AUXRESHAPEPROC);
  259.  
  260. typedef void (* AUXIDLEPROC)(void);
  261. void auxIdleFunc(AUXIDLEPROC);
  262.  
  263. typedef void (* AUXKEYPROC)(void);
  264. void auxKeyFunc(int, AUXKEYPROC);
  265.  
  266. typedef void (* AUXMOUSEPROC)(AUX_EVENTREC *);
  267. void auxMouseFunc(int, int, AUXMOUSEPROC);
  268.  
  269. int  auxGetColorMapSize(void);
  270. void auxGetMouseLoc(int *, int *);
  271. void auxSetOneColor(int, float, float, float);
  272. void auxSetFogRamp(int, int);
  273. void auxSetGreyRamp(void);
  274. void auxSetRGBMap(int, float *);
  275.  
  276.  
  277. AUX_RGBImageRec * auxRGBImageLoad(char *str);
  278.  
  279. void auxCreateFont(void);
  280. void auxDrawStr(char *str);
  281.  
  282. void auxWireSphere(GLdouble);
  283. void auxSolidSphere(GLdouble);
  284. void auxWireCube(GLdouble);
  285. void auxSolidCube(GLdouble);
  286. void auxWireBox(GLdouble, GLdouble, GLdouble);
  287. void auxSolidBox(GLdouble, GLdouble, GLdouble);
  288. void auxWireTorus(GLdouble, GLdouble);
  289. void auxSolidTorus(GLdouble, GLdouble);
  290. void auxWireCylinder(GLdouble, GLdouble);
  291. void auxSolidCylinder(GLdouble, GLdouble);
  292. void auxWireCone(GLdouble, GLdouble);
  293. void auxSolidCone(GLdouble, GLdouble);
  294. void auxWireIcosahedron(GLdouble);
  295. void auxSolidIcosahedron(GLdouble);
  296. void auxWireOctahedron(GLdouble);
  297. void auxSolidOctahedron(GLdouble);
  298. void auxWireTetrahedron(GLdouble);
  299. void auxSolidTetrahedron(GLdouble);
  300. void auxWireDodecahedron(GLdouble);
  301. void auxSolidDodecahedron(GLdouble);
  302.  
  303. void auxWireTeapot(GLdouble);
  304. void auxSolidTeapot(GLdouble);
  305.  
  306.  
  307. /*
  308. ** Viewperf support functions and constants
  309. */
  310. /* Display Mode Selection Criteria */
  311. enum {
  312.     AUX_USE_ID = 1,
  313.     AUX_EXACT_MATCH,
  314.     AUX_MINIMUM_CRITERIA
  315. };
  316.  
  317. void   auxInitDisplayModePolicy(GLenum);
  318. GLenum auxInitDisplayModeID(GLint);
  319. GLenum auxGetDisplayModePolicy(void);
  320. GLint  auxGetDisplayModeID(void);
  321. GLenum auxGetDisplayMode(void);
  322. AGLPixelFormat auxGetPixelFmt(void);
  323.  
  324. #ifdef __cplusplus
  325. }
  326. #endif
  327.  
  328. #endif /* __GLAUX_H__ */
  329.